<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
/*
 To do:
 - Make it so disabled buttons are not clickable (don't fire the onclick event)
 - Finish combo box functionality
 
*/
?>
<div id="theme_toolbar">
    <?
    
    foreach ($Content->aOptions as $sName => $aVals)
    {
        switch ($aVals["nType"])
        {
            case 0:             // REGULAR URL
                
                // add special classes
                
                if ($aVals["bDisabled"])
                {
                    $sClass="theme_toolbar_disabled";
                }
                elseif ($aVals["bHighlight"])
                {
                    $sClass="theme_toolbar_highlight";
                }
                else
                {
                    $sClass="";
                }
                
                ?>
                <a id="<?=$sName;?>" href="<?=$aVals["sAction"];?>" class="<?=$sClass;?>">
                <?


                if ($aVals["sImage"])
                {
                    
                    // add special classes
                    
                    if ($aVals["sCaption"])
                    {
                        $sImgClass="theme_toolbar_notext";
                    }
                    
                    ?>
                    <img id="<?=$sName;?>_img" class="<?=$sImgClass;?>" src="<?=CD_COMMON_2006;?>/icons/<?=$aVals["sImage"];?>">
                    <?
                }
                
                if ($aVals["sCaption"])
                {
                    ?>
                    <span id="<?=$sName;?>_txt"><?=$aVals["sCaption"];?></span>
                    <?
                }
                
                echo "</a>";
                
                break;



            case 6:             // Highlighted
                ?>                
                 <div class="theme_toolbar_highlight">
                    <?
                    if ($aVals["sImage"])
                    {
                        ?>
                        <img id="<?=$sName;?>_img" class="theme_toolbar_highlight" src="<?=CD_COMMON_2006;?>/icons/<?=$aVals["sImage"];?>">
                        <?
                    }
                    ?>
                    
                    <?=$aVals["sCaption"];?>
                    
                </div>
                <?
                break;

            case 5:             // Submit
                
                // add special classes
                
                if ($aVals["bDisabled"])
                {
                    $sClass="theme_toolbar_disabled";
                }
                elseif ($aVals["bHighlight"])
                {
                    $sClass="theme_toolbar_highlight";
                }
                else
                {
                    $sClass="";
                }
                
                ?>
                <a id="<?=$sName;?>" href="#" onclick="javascript:document.getElementById('<?=$aVals["sAction"];?>').submit();" class="<?=$sClass;?>">
                <?


                if ($aVals["sImage"])
                {
                    
                    // add special classes
                    
                    if ($aVals["sCaption"])
                    {
                        $sImgClass="theme_toolbar_notext";
                    }
                    
                    ?>
                    <img id="<?=$sName;?>_img" class="<?=$sImgClass;?>" src="<?=CD_COMMON_2006;?>/icons/<?=$aVals["sImage"];?>">
                    <?
                }
                
                if ($aVals["sCaption"])
                {
                    ?>
                    <span id="<?=$sName;?>_txt"><?=$aVals["sCaption"];?></span>
                    <?
                }
                
                echo "</a>";
                
                break;
            
            
            case 1:             // JavaScript

                // add special classes
                
                if ($aVals["bDisabled"])
                {
                    $sClass="theme_toolbar_disabled";
                }
                elseif ($aVals["bHighlight"])
                {
                    $sClass="highlight";
                }
                else
                {
                    $sClass="";
                }
                
                ?>
                <a id="<?=$aVals["sName"];?>" href="#" onclick="<?=$aVals["sAction"];?>" class="<?=$sClass;?>">
                <?
                
                if ($aVals["sImage"])
                {
                    if (!$aVals["sCaption"])
                    {
                        $sImgClass="notext";
                    }
                   
                    ?>
                    <img class="<?=$sImgClass;?>" src="<?=CD_COMMON_2006;?>/icons/<?=$aVals["sImage"];?>">
                    <?
                }
                
                if ($aVals["sCaption"])
                {
                    
                    echo $aVals["sCaption"];
                }
                
                echo "</a>";
                
                break;

            case 2:         // Multi-value
                /*                         onchange="javascript:window.location='<?=$sURL;?>'+document.getElementById('<?=$aProperties["sURL"];?>').options[document.getElementById('<?=$aProperties["sURL"];?>').selectedIndex].value;"> */
                ?>
                <div class="theme_toolbar_combo">
                    <select id="<?=$sName;?>" size="1" style="font-size: 8pt;" onchange="<?=$aVals["sAction"];?>" style="border: 1px solid #999;">
                        <?
                        foreach ($aVals["aVars"] as $sKey => $sValue)
                        {
                            ?>
                            <option value="<?=$sKey;?>"><?=$sValue;?></option>
                            <?
                        }
                        ?>
                    </select>
                </div>
                <?
                break;
            
            
            case 4:         // DIVIDER
                ?>
                <div class="theme_toolbar_break_left">
                    &nbsp;
                </div>
    
                <div class="theme_toolbar_break_right">
                    &nbsp;
                </div>
                <?
                break;
            
            case 3:         // No action
                ?>
                <div class="theme_toolbar_plain">
                    <?
                    if ($aProperties["sImage"])
                    {
                        ?>
                        <img src="<?=THEME_DIR;?>/images/<?=$aVals["sImage"];?>">
                        <?
                    }
                    ?>
                    
                    <?=$aVals["sCaption"];?>
                    
                </div>
                <?
                break;
        }
    }
?>
</div>
